<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>菜单查询</title>
    <base href="<%=basePath%>/">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1";/><!-- IE的渲染模式 -->
    <meta name="keywords" content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="description" content="信帧,teleframe,iparking,I停车,爱停车,blackshadowwalker" />
	<meta name="author" content="blackshadowwalker" />
    
	<link href="bootstrap/3/css/bootstrap.css" rel="stylesheet"/>

	<script src="scripts/jquery/jquery-1.7.min.js"></script>
	<script src="bootstrap/3/js/bootstrap.min.js"></script>
	<link href="css/common.css" rel="stylesheet" />
	
	<script type="text/javascript">
		var msg = "${msg}";
		if(msg!="")
			alert(msg);
	
		function del(id){
			if(confirm("确定删除吗？"))
				location.href="<%= basePath%>/${action}?method=delete&id="+id;
		}
		$(document).ready(function(){
    	});
	</script>
	
	<style>
		body{
			margin-left: 10px;
			margin-top: 7px;
		}
	</style>
	
  </head>
  
  <body onunload="location='about:blank'" >
  
  	<div>
		<div class="alert-info" style="">
			<s:if test="#request.add>0">
				 <a href="${action }?method=add&flag=1" style="color:#fff;"  class="btn btn-success " >
					添加菜单
				</a>
			</s:if>
			<div style="display:inline;margin-left:30px;color:#f00;">
				${msg }
			</div>
		</div >
	</div>
	
  <table class="  table-hover" style="width:100%;">
  		
  		<tr>
  			<th class="hidden"> id</th>
  			<th class="hidden">排序</th>
  			<th >菜单名称</th>
  			<th class="visible-lg-block" style="width:150px;" >描述</th>
  			<th >链接地址</th>
  			<th class="hidden visible-lg-block" >级别</th>
  			<th class="visible-lg-block" style="width:40px;" >显示</th>
  			<th class="visible-lg-block" style="width:260px;" >权限</th>
  			<th >状态</th>
  			<s:if test="#request.delete>0 || #request.update>0">
  				<th style="width:140px;" >操作</th>
  			</s:if>
  		</tr>
  
	   <s:iterator id="l"  value="list" status="index">  
			
			<s:if test="level==1">
				<tr>
					<td class="hidden"> ${rulerid }</td>
					<td class="hidden"> ${sortorder }</td>
					<td><s:property value="#l.rulerName" /></td>
					<td class="visible-lg-block">${description } </td>
					<td>${url } </td>
					<td class="hidden">${level } </td>
					<td>${echo } </td>
					<td class="visible-lg-block"> 
						<s:iterator value="methods" id="rms">
							${method },${name};
						</s:iterator>
					</td>
					<td>${status } </td>
					<s:if test="#request.delete>0 || #request.update>0">
					  <td>
						<s:if test="#request.delete>0">
							<a class="btn btn-danger"  title="删除" href="javascript:del(${rulerid})">
								<span class="glyphicon glyphicon-trash"></span>
							</a>
						</s:if>
						<s:if test="#request.update>0">
							<a class="btn btn-primary" href="${action }?method=update&id=${rulerid}" title="修改">
								<span class="glyphicon glyphicon-edit"></span>
							</a>
							<a class="btn btn-success" href="${action }?method=add&rulerInfo.manager=${rulerid }&rulerInfo.level=2" title="添加子菜单">
								<span class="glyphicon glyphicon-plus-sign"></span>
							</a>
						</s:if>
					  </td>
					</s:if>
				</tr>
				<!-- 子菜单  -->
				<s:iterator id="l2"  value="#l.subRulerList" status="index2">  
						<tr>
							<td class="hidden">${rulerid }</td>
							<td class="hidden"> ${sortorder }</td>
							<td>  &nbsp; &nbsp;---- ${rulerName }</td>
							<td class="visible-lg-block">${description } </td>
							<td>${url } </td>
							<td class="hidden" >${level } </td>
							<td>${echo } </td>
							<td class="visible-lg-block">
								<s:iterator value="methods" id="rms">
									${method },${name};
								</s:iterator>
							</td>
							<td>${status } </td>
							<td>
								<s:if test="#request.delete>0">
									<a class="btn btn-danger" title="删除" href="javascript:del(${rulerid})">
										<span class="glyphicon glyphicon-trash"></span>
									</a>
								</s:if>
								<s:if test="#request.update>0">
									<a class="btn btn-primary" href="${action }?method=update&id=${rulerid}" title="修改">
										<span class="glyphicon glyphicon-edit"></span>
									</a>
								</s:if>
							</td>
						</tr>
				</s:iterator>
				
			</s:if>
			
			
	  </s:iterator>
  	</table>
	
	<br/>
	<br/>
	
	<script>
			//防止后退
			window.history.forward();
			
			//防止刷新(方法一般，但有效果)
			//<body onunload="location='about:blank'>"
			
			$(window).resize(function() {
   				var width = $(this).width();
    			var height = $(this).height();
    			console.log(width+" "+height);
			});
			
	</script>
	
  </body>
</html>
